<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:insert="~{include :: header('修改会员商品')}" />
</head>
<body class="hold-transition">
<div class="container-fluid mt-2 mb-2">
        <form class="form-horizontal m" id="form-sale-edit" th:object="${memberSale}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group row" style="margin-top: 30px">
                <label class="col-sm-2 col-form-label is-required text-sm-right">商品名称</label>
                <div class="col-sm-6">
                    <input name="name" th:field="*{name}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label is-required text-sm-right">类型</label>
                <div class="col-sm-4">
                    <select name="typeId" class="form-control m-b" th:with="type=${memberType}">
                        <option th:each="dict : ${type}" th:text="${dict.title}" th:value="${dict.id}" th:field="${memberSale.typeId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label is-required text-sm-right">价格</label>
                <div class="col-sm-4">
                    <input name="price" th:value="*{price/100.0}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label is-required text-sm-right">开通天数</label>
                <div class="col-sm-4">
                    <input name="days" th:field="*{days}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group row">
                <label class="col-sm-2 col-form-label text-sm-right">排序</label>
                <div class="col-sm-4">
                    <input name="sort" th:field="*{sort}" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group row">
                <label class="col-sm-2 col-form-label text-sm-right">描述</label>
                <div class="col-sm-8">
                    <textarea style="min-height: 100px" name="description" th:text="*{description}" class="form-control" type="text"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:insert="~{include :: footer}" />
    <script type="text/javascript">
        $("#form-sale-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save("/member/sale/save.json", $('#form-sale-edit').serialize());
            }
        }
    </script>
</body>
</html>